<?php
/**
 * @author Erling Owe <erling.owe@gmail.com>
 * @package Core
 */

/**
 * Use ArrayObject unless methods from this class are specificly needed.
 */
class Core_Collection extends ArrayObject {

//    final public function clear () {
//
//    }

//    final public function contains ( $mixItem ) {
//
//    }

    /**
     * Gets the key of a given item.
     *
     * @param mix $mixItem
     * @return boolean|integer The key if the item is found in the collection, false if not.
     */
    final public function keyOf ( $mixItem ) {
        foreach ( $this as $key => $value ) {
            if ( $value === $mixItem ) {
                return $key;
            }
        }
        return false;
    }

//    final public function insert ( $mixItem, $intIndex ) {
//
//    }

//    final public function remove ( $intIndex ) {
//
//    }

//    final public function replace ( $intIndex, $mixItem ) {
//
//    }

    /**
     * Converts the collection to an array.
     *
     * @return array
     */
    public function toArray () {
        return (array) $this;
    }

}

?>
